﻿using EntityFramework.Entity.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YouTravel.DomainModels;

namespace Repositories.Configuration
{
    public class CollectInvoiceGroupMap : EntityConfigurationBase<CollectInvoiceGroup>
    {
        public CollectInvoiceGroupMap()
        {
            this.Property(p => p.GroupCode).HasMaxLength(20).IsRequired();
            this.Property(p => p.Name).HasMaxLength(100).IsRequired();

            this.HasRequired(p => p.CollectInvoice).WithMany(p => p.CollectInvoiceGroup).HasForeignKey(p => p.CollectInvoiceId);
            this.HasMany(p => p.CollectInvoiceDetail).WithRequired(p => p.CollectInvoiceGroup).HasForeignKey(p => p.GroupId);
        }
    }
}
